<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:StyleMVVM.WPF" xmlns:View="clr-namespace:StyleMVVM.View">


    <Style TargetType="{x:Type View:MessageBoxWindow}">
        <Setter Property="ResizeMode" Value="NoResize"/>
        <Setter Property="Background" Value="White"/>
        <Setter Property="View:ViewModel.Name" Value="MessageBoxWindowViewModel" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type View:MessageBoxWindow}">
                    <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#A0606060" IsHitTestVisible="True">
                        <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            HorizontalAlignment="Stretch" VerticalAlignment="Center" MinHeight="130">
                            <Grid HorizontalAlignment="Stretch" Margin="5,10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="32*"/>
                                    <ColumnDefinition Width="36*"/>
                                    <ColumnDefinition Width="32*"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <TextBlock FontSize="20" Grid.Column="1" Margin="5"
                                           Text="{TemplateBinding Title}" VerticalAlignment="Center"/>
                                <TextBlock Grid.Column="1" Grid.Row="1" Margin="5"
                                           Text="{TemplateBinding Message}" TextWrapping="WrapWithOverflow" VerticalAlignment="Center"/>
                                <ItemsControl  Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" 
                                    ItemsSource="{TemplateBinding Commands}">
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal"></StackPanel>
                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <Button MinWidth="100" Margin="5" View:EventHandlers.Attach="Click => ClickHandler($dataContext)"
                                                Content="{Binding DisplayString}" 
                                                    IsDefault="{Binding IsDefault}"
                                                    IsCancel="{Binding IsCancel}"/>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                            </Grid>
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
